<?php $this->load->view('layout/header');?>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <h3 class="page-title">景区管理 <small>景区</small></h3>
            <?php echo breadcrumb(array('scenery/index'=>'景区管理', '添加景区')); ?>
        </div>
    </div>
    <div class="alert alert-error" style="display:none;">
        <button data-dismiss="alert" class="close"></button>
        <a href="javascript:;" class="glyphicons no-js remove_2"><i></i><p></p></a>
    </div>
    <div class="row-fluid">
        <div class="span12">
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption"><i class="icon-plus-sign"></i>添加景区</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <div class="portlet-body form">
                    <form class="form-horizontal savescenery-validate-form" action="<?php echo base_url('scenery/addPost') ?>" method="post" enctype="multipart/form-data">
                        <div class="alert alert-success">景区基本信息</div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>旅游主题</label>
                            <div class="controls">
                                <select name="category_id" class="m-wrap span8 required">
                                    <?php foreach ($sceniccategory->result() as $value):?>
                                    <option value="<?php echo $value->category_id;?>"><?php echo $value->category_name?></option>
                                    <?php endforeach;?>
                                </select>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>景区名称</label>
                            <div class="controls">
                                <input type="text" name="name_hanzi" class="m-wrap span8 required">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">景区名称（拼音）</label>
                            <div class="controls">
                               <input type="text" name="name_pinyin" class="m-wrap span8">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">景点特色</label>
                            <div class="controls">
                                <textarea name="name_english" rows="3" class="m-wrap span8"></textarea>
                            </div>
                        </div>
                        <div class="control-group add-supplieruid-html">
                            <label class="control-label"><em>* </em>供应商</label>
                            <div class="controls">
                               <input type="text" name="uid" id="supplier-uid" class="m-wrap span8 supplieruid required tooltips number" data-original-title="双击可弹框选择供应商；直接输入‘用户名称或编号’可提示" data-trigger="hover">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">开放时间</label>
                            <div class="controls">
                               <input type="text" name="open_time" class="m-wrap span8 required">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>景区星级</label>
                            <div class="controls">
                                <select name="star_rank" class="m-wrap span8">
                                <?php for ($i=5; $i>=1; $i--) :?>
                                    <option value="<?php echo $i;?>"><?php echo $i;?>A 级景区</option>
                                <?php endfor;?>
                                </select>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>上下架</label>
                            <div class="controls">
                                <select name="bit_state" class="m-wrap span8">
                                    <option value="1">上架</option>
                                    <option value="0">下架</option>
                                </select>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>是否可买</label>
                            <div class="controls">
                                <select name="isbuy" class="m-wrap span8">
                                    <option value="1">是</option>
                                    <option value="0">否</option>
                                </select>
                            </div>
                        </div>
                        <div class="alert alert-success">地址详情</div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>所在省份</label>
                            <div class="controls">
                                <?php $this->load->view('commonhtml/districtSelect');?>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>详细地址</label>
                            <div class="controls">
                                <input type="text" name="address" class="m-wrap span8 required" >
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">百度经度</label>
                            <div class="controls">
                                <input type="text" name="baidulng" value="0" class="m-wrap span8 number">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">百度纬度</label>
                            <div class="controls">
                                <input type="text" name="baidulat" value="0" class="m-wrap span8 number">
                            </div>
                        </div>
                        <div class="alert alert-success">景区详细信息</div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>门票类型说明</label>
                            <div class="controls">
                                <textarea name="ticket_notic" class="textarea-multipart-edit required"></textarea>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>景区须知</label>
                            <div class="controls">
                                <textarea name="guidelines" class="textarea-multipart-edit required"></textarea>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label"><em>* </em>景区详情</label>
                            <div class="controls">
                                <textarea name="info" class="textarea-multipart-edit required"></textarea>
                            </div>
                        </div>
                         <div class="control-group">
                            <label class="control-label">交通线路</label>
                            <div class="controls">
                                <textarea name="traffic" class="textarea-multipart-edit"></textarea>
                            </div>
                        </div>
                         <div class="control-group">
                            <label class="control-label">注意事项</label>
                            <div class="controls">
                                <textarea name="notice" class="textarea-multipart-edit"></textarea>
                            </div>
                        </div>
                        <div class="alert alert-success">接口信息</div>
                        <div class="control-group">
                            <label class="control-label">接口类型</label>
                            <div class="controls">
                                <input type="text" name="jiekou_type" value="0" class="m-wrap span8 number">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">他网ID</label>
                            <div class="controls">
                                <input type="text" name="other_scen_id" value="0" class="m-wrap span8 number">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">商家编号</label>
                            <div class="controls">
                                <input type="text" name="other_saler_id" value="0" class="m-wrap span8 number">
                            </div>
                        </div>
                        <div class="alert alert-success">其它信息</div>
                        <div class="control-group">
                            <label class="control-label">景区销量</label>
                            <div class="controls">
                                <input type="text" name="sales_volume" value="0" class="m-wrap span8 number">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">景区点击量</label>
                            <div class="controls">
                                <input type="text" name="click_count" value="0" class="m-wrap span8 number">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">景区排序</label>
                            <div class="controls">
                                <input type="text" name="sort_order" value="0" class="m-wrap span8 number">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">位置推荐</label>
                            <div class="controls">
                                <select name="flag_1" class="m-wrap span8">
                                    <?php foreach ($flag_1 as $kk=>$vv) :?>
                                    <option value="<?php echo $kk;?>"><?php echo $vv;?></option>
                                    <?php endforeach;?>
                                </select>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">flag_2</label>
                            <div class="controls">
                                <input type="text" name="flag_2" value="0" class="m-wrap span8 number">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">flag_3</label>
                            <div class="controls">
                                <input type="text" name="flag_3" value="0" class="m-wrap span8 number">
                            </div>
                        </div>
                        <div class="form-actions">
                            <button class="btn green" type="submit"><i class="icon-ok"></i> 保存</button>
                            <a href="<?php echo base_url('scenery/grid') ?>">
                                <button class="btn" type="button">返回</button>
                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $this->load->view('layout/footer');?>
<?php $this->load->view('user/addSupplierUid/ajaxGetUser');?>
<script type="text/javascript">
$(document).ready(function(){
    $('.savescenery-validate-form').submit(function () {
        return false;
    }).validate({
        ignore: '',
        submitHandler: function (f) {
            $.ajax({
                type: 'post',
                async: true,
                dataType: 'json',
                url: hostUrl() + '/scenery/ajaxValidate',
                data: $('form.savescenery-validate-form').serialize(),
                success: function (data) {
                    if (data.status) {
                        $('.alert-error').hide();
                        window.location.href = data.messages;
                    } else {
                        $('.alert-error').show();
                        $('.alert-error .remove_2 p').html(data.messages);
                        var body = (window.opera) ? (document.compatMode == 'CSS1Compat' ? $('html') : $('body')) : $('html,body');
                        body.animate({scrollTop: $('.page-container').offset().top}, 1000);
                    }
                }
            });
        }
    });
});
</script>